/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package csse3004.GD.PM;

import org.springframework.web.servlet.mvc.SimpleFormController;
import org.springframework.web.servlet.ModelAndView;
import javax.servlet.ServletException;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.springframework.web.servlet.view.RedirectView;

public class CreateTempController extends SimpleFormController {
    /** Logger for this class and subclasses */
    protected final Log logger = LogFactory.getLog(getClass());

    public ModelAndView onSubmit(Object command) throws ServletException {        

        CreateTemp ct = (CreateTemp)command;
        
        String tempMsg = "Template has been successfully added!";
        
        String tempName = ct.getTempName();
        
        // DB function to insert template name into the list
        
        return new ModelAndView("successMsg", "tempMsg", tempMsg);
        
        //return new ModelAndView(new RedirectView(getSuccessView()));
    }
}
